home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 25 / AACD 25.iso / AACD / Programming / yaec / modules / amigalib.e < prev    next >
Encoding:
Text File  |  2001-08-12  |  9.0 KB  |  127 lines

  1. OPT MODULE  
  2. OPT EXPORT
  3. OPT NDDC
  4. OPT LINK 'e:linklib/small.lib' -> change to Your setup..
  5. OPT XREF _BeginIO, _CreateExtIO, _CreatePort, _CreateStdIO, _CreateTask,
  6.          _DeleteExtIO, _DeletePort, _DeleteStdIO, _DeleteTask,
  7.          _NewList,
  8.          ->_LibAllocPooled, _LibCreatePool, _LibDeletePool, _LibFreePooled,
  9.          _FastRand, _RangeRand,
  10.          _AddTOF, _RemTOF, _waitbeam,
  11.          ->_afp, _arnd, _dbf, _fpa, _fpbcd,
  12.          _TimeDelay, _DoTimer,
  13.          ->_ArgArrayDone, _ArgArrayInit, _ArgInt, _ArgString,
  14.          _HotKey, _InvertString, _FreeIEvent,
  15.          _CheckRexxMsg, _GetRexxVar, _SetRexxVar,
  16.          _CallHookA, _CallHook,
  17.          _DoMethodA, _DoMethod,
  18.          _DoSuperMethodA, _DoSuperMethod,
  19.          _CoerceMethodA, _CoerceMethod,
  20.          _SetSuperAttrs,
  21.          _ACrypt
  22.  
  23.  
  24.  
  25. -> YAEC 1.8+ MODULE for amiga.lib
  26. -> based on clib/alib_protos.h
  27. -> using the new #macro keyword, enjoy.. this was hard work!
  28. -> (LS)
  29.  
  30. -> 1.9 : FIX : some (very few) functions could return crap.
  31.  
  32. /*  Exec support functions */
  33.  
  34. #macro BeginIO(ioreq:PTR TO io) (VOID) IS Stores(io) BUT ASM ' bsr _BeginIO' BUT ASM ' addq.l #4, a7'
  35. #macro CreateExtIO(port:PTR TO mp, iosize:LONG) (PTR TO io) IS Stores(port, iosize) BUT ASM ' bsr _CreateExtIO' BUT ASM ' addq.l #8, a7'
  36. #macro CreatePort(name:PTR TO CHAR, pri:LONG) (PTR TO mp) IS Stores(name,pri) BUT ASM ' bsr _CreatePort' BUT ASM ' addq.l #8, a7'
  37. #macro CreateStdIO(port:PTR TO mp) (PTR TO iostdreq) IS Stores(port) BUT ASM ' bsr _CreateStdIO' BUT ASM ' addq.l #4, a7'
  38. #macro CreateTask(name:PTR TO CHAR, pri:LONG, initpc:PTR TO ANY, stacksize:LONG) (PTR TO task) IS Stores(name,pri,initpc,stacksize) BUT ASM ' bsr _CreateTask' BUT ASM ' lea 16(a7), a7'
  39. #macro DeleteExtIO(ioreq:PTR TO iorequest) (VOID) IS Stores(ioreq) BUT ASM ' bsr _DeleteExtIO' BUT ASM ' addq.l #4, a7'
  40. #macro DeletePort(ioreq:PTR TO mp) (VOID) IS Stores(ioreq) BUT ASM ' bsr _DeletePort' BUT ASM ' addq.l #4, a7'
  41. #macro DeleteStdIO(ioreq:PTR TO iostreq) (VOID) IS Stores(ioreq) BUT ASM ' bsr _DeleteStdIO' BUT ASM ' addq.l #4, a7'
  42. #macro DeleteTask(task:PTR TO task) (VOID) IS Stores(task) BUT ASM ' bsr _DeleteTask' BUT ASM ' addq.l #4, a7'
  43. #macro NewList(list:PTR TO mlh) (VOID) IS Stores(list) BUT ASM ' bsr _NewList' BUT ASM ' addq.l #4, a7'
  44. -> yaec-note : theese are in exec.library anyway..
  45. ->#macro LibAllocPooled(poolheader:PTR TO ANY, memsize:LONG) (PTR TO ANY) IS Stores(poolheader,memsize) BUT ASM ' bsr _LibAllocPooled' BUT ASM ' addq.l #8, a7'
  46. ->#macro LibCreatePool(memflags:LONG, puddlesize:LONG, treshsize:LONG) (PTR TO ANY) IS Stores(memflags,puddlesize,treshsize) BUT ASM ' bsr _LibCreatePool' BUT ASM ' lea 12(a7), a7'
  47. ->#macro LibDeletePool(poolheader:PTR TO ANY) (VOID) IS Stores(poolheader) BUT ASM ' bsr _LibDeletePool' BUT ASM ' addq.l #4, a7'
  48. ->#macro LibFreePooled(poolheader:PTR TO ANY, memory:PTR TO ANY, memsize:LONG) (PTR TO ANY) IS Stores(poolheader,memory,memsize) BUT ASM ' bsr _LibDeletePool' BUT ASM ' lea 12(a7), a7'
  49.  
  50. /* Assorted functions in amiga.lib */
  51.  
  52. #macro FastRand(seed:LONG) (LONG) IS Stores(seed) BUT ASM ' bsr _FastRand' BUT ASM ' addq.l #4, a7'
  53. #macro RangeRand(maxvalue:LONG) (LONG) IS Stores(maxvalue) BUT ASM ' bsr _RangeRand' BUT ASM ' addq.l #4, a7'
  54. -> yaec-note : global RangeSeed can not be reached,
  55. -> use this function instead. Returns oldseed.
  56. #macro SetRangeSeed(newseed:LONG) (LONG) IS (D1 := newseed) BUT ASM ' move.l _RangeSeed(a4), d0' BUT ASM ' move.l d1, RangeSeed(a4)'
  57.  
  58. /* Graphics support functions in amiga.lib */
  59.  
  60. #macro AddTOF(i_:PTR TO isrvstr, p_:PTR TO ANY, a_:LONG) (VOID) IS Stores(i_,p_,a_) BUT ASM ' bsr _AddTOF' BUT ASM ' lea 12(a7), a7'
  61. #macro RemTOF(i_:PTR TO isrvstr) (VOID) IS Stores(i_) BUT ASM ' bsr _RemTOF' BUT ASM ' addq.l #4, a7'
  62. #macro waitbeam(b_:LONG) (VOID) IS Stores(b_) BUT ASM ' bsr _waitbeam' BUT ASM ' addq.l #4, a7'
  63.  
  64. /* math support functions in amiga.lib */
  65. -> yaec : uses motorola fast floating point, E uses IEEE. Reming them out..
  66. ->#macro afp(string:PTR TO CHAR) (FLOAT) IS Stores(string) BUT ASM ' bsr _afp' BUT ASM ' addq.l #4, a7'
  67. ->#macro arnd(place:LONG, exp:LONG, string:PTR TO CHAR) (VOID) IS Stores(place,exp,string) BUT ASM ' bsr _arnd' BUT ASM ' lea 12(a7), a7'
  68. ->#macro dbf(exp:LONG, mant:LONG) (FLOAT) IS Stores(exp,mant) BUT ASM ' bsr _dbf' BUT ASM ' addq.l #8, a7'
  69. ->#macro fpa(fnum:FLOAT, string:PTR TO CHAR) (LONG) IS Stores(fnum,string) BUT ASM ' bsr _fpa' BUT ASM ' addq.l #8, a7'
  70. ->#macro fpbcd(fnum:FLOAT, string:PTR TO CHAR) (VOID) IS Stores(fnum,string) BUT ASM ' bsr _fpbcd' BUT ASM ' addq.l #8, a7'
  71.  
  72. /* Timer support functions in amiga.lib (V36 and higher only) */
  73.  
  74. #macro TimeDelay(unit:LONG, secs:LONG, mseconds:LONG) (LONG) IS Stores(unit,secs,mseconds) BUT ASM ' bsr _TimeDelay' BUT ASM ' lea 12(a7), a7'
  75. #macro DoTimer(tv:PTR TO timeval, unit:LONG, command:LONG) (LONG) IS Stores(tv,unit,command) BUT ASM ' bsr _DoTimer' BUT ASM ' lea 12(a7), a7'
  76.  
  77. /*  Commodities functions in amiga.lib (V36 and higher only) */
  78.  
  79. -> yaec : not sure how theese will work with yaec..
  80. ->#macro ArgArrayDone() (VOID) IS ASM ' bsr _ArgArrayDone'
  81. ->#macro ArgArrayInit(argc:LONG, argv:PTR TO ANY) (PTR TO ANY) IS Stores(argc,argv) BUT ASM ' bsr _ArgArrayInit' BUT ASM ' addq.l #8, a7'
  82. ->#macro ArgInt(tt:PTR TO ANY, entry:PTR TO CHAR, defaultval:LONG) (LONG) IS Stores(tt,entry,defaultval) BUT ASM ' bsr _ArgInt' BUT ASM ' lea 12(a7), a7'
  83. ->#macro ArgString(tt:PTR TO ANY, entry:PTR TO CHAR, defaulstring:PTR TO CHAR) (PTR TO CHAR) IS Stores(tt,entry,defaultval) BUT ASM ' bsr _ArgString' BUT ASM ' lea 12(a7), a7'
  84.  
  85. #macro HotKey(description:PTR TO CHAR, port:PTR TO mp, id:LONG) (PTR TO cxobj) IS Stores(description,port,id) BUT ASM ' bsr _HotKey' BUT ASM ' lea 12(a7), a7'
  86. #macro InvertString(str_:PTR TO CHAR, km:PTR TO keymap) (PTR TO inputevent) IS Stores(str_,km) BUT ASM ' bsr _InvertString' BUT ASM ' addq.l #8, a7'
  87. #macro FreeIEvents(events:PTR TO inputevent) (VOID) IS Stores(events) BUT ASM ' bsr _FreeIEvents' BUT ASM ' addq.l #4, a7'
  88.  
  89. /* Commodities #macros */
  90. -> yaec: theese already exists in libraries/commodities.e..reming..
  91. ->#macro CxFilter(d:PTR TO CHAR)              (PTR TO cxobj) IS CreateCxObj(CX_FILTER, d, 0)
  92. ->#macro CxSender(port:PTR TO mp, id:LONG)    (PTR TO cxobj) IS CreateCxObj(CX_SEND, port, id)
  93. ->#macro CxSignal(task:PTR TO task, sig:LONG) (PTR TO cxobj) IS CreateCxObj(CX_SIGNAL, task, sig)
  94. ->#macro CxTranslate(ie:PTR TO inputevent)    (PTR TO cxobj) IS CreateCxObj(CX_TRANSLATE, ie, 0)
  95. ->#macro CxDebug(id:LONG)                     (PTR TO cxobj) IS CreateCxObj(CX_DEBUG, id, 0)
  96. ->#macro CxCustom(action:PTR TO ANY, id:LONG) (PTR TO cxobj) IS CreateCxObj(CX_CUSTOM, action, id)
  97.  
  98.  
  99. /*  ARexx support functions in amiga.lib */
  100.  
  101. #macro CheckRexxMsg(rexxmsg:PTR TO mn) (LONG) IS Stores(rexxmsg) BUT ASM ' bsr _CheckRexxMsg' BUT ASM ' addq.l #4, a7'
  102. #macro GetRexxVar(rexxmsg:PTR TO mn, name:PTR TO CHAR, result:PTR TO ANY) (LONG) IS Stores(rexxmsg,name,result) BUT ASM ' bsr _GetRexxVar' BUT ASM ' lea 12(a7), a7'
  103. #macro SetRexxVar(rexxmsg:PTR TO mn, name:PTR TO CHAR, value:PTR TO CHAR, length:LONG) (LONG) IS Stores(rexxmsg,name,value,length) BUT ASM ' bsr _SetRexxVar' BUT ASM ' lea 16(a7), a7'
  104.  
  105. /*  Intuition hook and boopsi support functions in amiga.lib. */
  106. /*  These functions do not require any particular ROM revision */
  107. /*  to operate correctly, though they deal with concepts first introduced */
  108. /*  in V36.  These functions would work with compatibly-implemented */
  109. /*  hooks or objects under V34. */
  110.  
  111. #macro CallHookA(hookptr:PTR TO hook, obj:PTR TO object, message:ANY) (ANY) IS Stores(hookptr,obj,msg) BUT ASM ' bsr _CallHookA' BUT ASM ' lea 12(a7), a7'
  112. #macro CallHook(hookptr:PTR TO hook, obj:PTR TO object,...) (ANY) IS Stores(hookptr,obj,...) BUT ASM ' bsr _CallHook' BUT Rems(VARARGS+2*4) BUT D0
  113. #macro DoMethodA(obj:PTR TO object, message:PTR TO msg) (ANY) IS Stores(obj,msg) BUT ASM ' bsr _DoMethodA' BUT ASM ' addq.l #8, a7'
  114. #macro DoMethod(obj:PTR TO object, methodid:LONG,...) (ANY) IS Stores(obj,methodid,...) BUT ASM ' bsr _DoMethod' BUT Rems(VARARGS+2*4) BUT D0
  115. #macro DoSuperMethodA(cl:PTR TO iclass, obj:PTR TO object, message:PTR TO msg) (ANY) IS Stores(cl,obj,message) BUT ASM ' bsr _DoSuperMethodA' BUT ASM ' lea 12(a7), a7'
  116. #macro DoSuperMethod(cl:PTR TO iclass, obj:PTR TO object, methodid:LONG,...) (ANY) IS Stores(cl,obj,methodid,...) BUT ASM ' bsr _DoSuperMethod' BUT Rems(VARARGS+3*4) BUT D0
  117. #macro CoerceMethodA(cl:PTR TO iclass, obj:PTR TO object, message:PTR TO msg) (ANY) IS Stores(cl,obj,message) BUT ASM ' bsr _CoerceMethodA' BUT ASM ' lea 12(a7), a7'
  118. #macro CoerceMethod(cl:PTR TO iclass, obj:PTR TO object, methodid:LONG,...) (ANY) IS Stores(cl,obj,methodid,...) BUT ASM ' bsr _CoerceMethod' BUT Rems(VARARGS+3*4) BUT D0
  119. #macro SetSuperAttrs(cl:PTR TO iclass, obj:PTR TO object, tag1:ANY,...) (ANY) IS Stores(cl,obj,tag1,...) BUT ASM ' bsr _SetSuperAttrs' BUT Rems(VARARGS+3*4) BUT D0
  120.  
  121. /*  Network-support functions in amiga.lib. */
  122. /*  ACrypt() first appeared in later V39 versions of amiga.lib, but */
  123. /*  operates correctly under V37 and up. */
  124.  
  125. #macro ACrypt(buffer:PTR TO CHAR, password:PTR TO CHAR, username:PTR TO CHAR) (PTR TO CHAR) IS Stores(buffer,password,username) BUT ASM ' bsr _ACrypt' BUT ASM ' lea 12(a7), a7'
  126.  
  127.